var a = undefined;
var b = null;

if (!a) {
    console.log("undefined is false");
}

if (!b) {
    console.log("null is false");
}

console.log(a == b);

console.log(typeof a);//undefined is typeof undefined
console.log(typeof b);//null is typeof object


//javascript中，默认 undefined、NaN、null、0、false、""、'' ， 在判断布尔值的时候都是false
if (!undefined) {
    console.log("undefined is false");
}

if (!NaN) {
    console.log("NaN is false");
}
if (!null) {
    console.log("null is false");
}
if (!0) {
    console.log("0 is false");
}
if (!false) {
    console.log("false is false");
}
if (!"") {
    console.log("\"\" is false");
}
if (!'') {
    console.log("'' is false");
}

// 空对象 空数组 则为true
if ({}) {
    console.log("{} is true");
}
if ([]) {
    console.log("[] is true");
}

//类
var user = {
    name: "QQJY",
    age: 27
};
console.log(user);

var student = {};
student.name = "Tom";
student.age = 15;
console.log(student);

//可以使用delete object.? 来删除对象中的属性，删除成功同时返回true
console.log(delete student.name);


//类的便利属性
function User(name) {
    this.name = name;
}

User.prototype.describe = function () {
    return "Name: " + this.name;
};

var user1 = new User("QQJY");
for (var key in user1) {
    console.log(key);
}
for (var key in user1) {
    //通过这个判断可以过滤掉继承的属性
    if (user1.hasOwnProperty(key)) {
        console.log(key);
    }
}

console.log([1, 2] + [3]);
console.log(parseInt("42 abc"));
console.log(Number("42 abc"));
